<template>
  <div class="comp" v-if="list.length > 0">
    <div
      class="top"
      @click="gotoContent({ id: list[0].id, title: list[0].title })"
    >
      <div class="left">
        <img v-lazy="list[0].cover" alt="" />
        <div class="play" v-if="isAudio">
          <van-icon name="play-circle" size="20" color="#fff" />
        </div>
      </div>
      <div class="right">
        <div class="title">
          <h3>{{ list[0].title }}</h3>
        </div>
        <div class="author">{{ list[0].author }}</div>
        <div class="content">
          {{ list[0].recomContent }}
        </div>
      </div>
    </div>
    <horizontalList
      :childrenList="list.slice(1)"
      :isAudio="isAudio"
      @gotoContent="gotoContent"
    ></horizontalList>
  </div>
</template>

<script>
import horizontalList from "@/components/horizontalList";
export default {
  components: {
    horizontalList,
  },
  props: {
    list: {
      type: Array,
      default() {
        return [];
      },
    },
    isAudio: {
      type: Boolean,
      default: false,
    },
  },
  methods: {
    gotoContent(obj) {
      this.$router.push(
        "/content?source_uuid=" + obj.id + "&title=" + obj.title
      );
    },
  },
};
</script>

<style lang="scss" scoped>
.comp {
  font-size: 16px;
}
.top {
  width: 100%;
  display: flex;
  .left {
    width: 30%;
    position: relative;
    img {
      width: 100%;
      height: 100%;
      display: block;
    }
    .play {
      position: absolute;
      bottom: 14px;
      left: 8px;
    }
  }
  .right {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-left: 10px;
    text-align: justify;
    .title {
      font-size: 20px;
    }
    .author {
      font-size: 16px;
      color: #888;
    }
    .content {
      font-size: 16px;
      line-height: 1.4;
      color: #888;
    }
  }
}
</style>
